import { legacy_createStore as createStore } from 'redux';

const initState = { count: 99, msg: 'hello React', list: [] };

function countReducer(state = initState, { type, payload }) {
  console.warn('  ----->  ', state, type, payload);

  switch (type) {
    case 'add':
      return { ...state, count: state.count + payload };
    case 'des':
      return { ...state, count: state.count - payload };
    default:
      return state;
  }
}

const store = createStore(countReducer);

export default store;
